<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.4"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Flow: flow::log::Config::Atomic_raw_sev Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectalign">
   <div id="projectname">Flow<span id="projectnumber">&#160;2.0.0</span>
   </div>
   <div id="projectbrief">Flow project: Full implementation reference.</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.4 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search",'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="namespaceflow.html">flow</a></li><li class="navelem"><a class="el" href="namespaceflow_1_1log.html">log</a></li><li class="navelem"><a class="el" href="classflow_1_1log_1_1Config.html">Config</a></li><li class="navelem"><a class="el" href="classflow_1_1log_1_1Config_1_1Atomic__raw__sev.html">Atomic_raw_sev</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="classflow_1_1log_1_1Config_1_1Atomic__raw__sev-members.html">List of all members</a>  </div>
  <div class="headertitle"><div class="title">flow::log::Config::Atomic_raw_sev Class Reference</div></div>
</div><!--header-->
<div class="contents">

<p>Trivial wrapper of <code>atomic&lt;raw_sev_t&gt;</code> which adds a couple of things to make it possible to construct, and therefore use, a <code>vector</code> of such <code>atomic</code>s.  
 <a href="classflow_1_1log_1_1Config_1_1Atomic__raw__sev.html#details">More...</a></p>
<div class="dynheader">
Inheritance diagram for flow::log::Config::Atomic_raw_sev:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="classflow_1_1log_1_1Config_1_1Atomic__raw__sev__inherit__graph.svg" width="131" height="119"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
</div>
<center><span class="legend">[<a href="graph_legend.html">legend</a>]</span></center></div>
<div class="dynheader">
Collaboration diagram for flow::log::Config::Atomic_raw_sev:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="classflow_1_1log_1_1Config_1_1Atomic__raw__sev__coll__graph.svg" width="131" height="204"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
</div>
<center><span class="legend">[<a href="graph_legend.html">legend</a>]</span></center></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pub-methods" name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a0edf54321d64532405b9786dd707e026"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classflow_1_1log_1_1Config_1_1Atomic__raw__sev.html#a0edf54321d64532405b9786dd707e026">Atomic_raw_sev</a> (<a class="el" href="classflow_1_1log_1_1Config.html#acae76e3367bd497f5b00f46e48b3a39c">raw_sev_t</a> init_val=<a class="el" href="classflow_1_1log_1_1Config.html#acae76e3367bd497f5b00f46e48b3a39c">raw_sev_t</a>(-1))</td></tr>
<tr class="memdesc:a0edf54321d64532405b9786dd707e026"><td class="mdescLeft">&#160;</td><td class="mdescRight">Constructs the atomic to the given value, guaranteed to be <code>load()</code>ed as such in all subsequent accesses incl from other threads, even if <code>memory_order_relaxed</code> is used.  <a href="classflow_1_1log_1_1Config_1_1Atomic__raw__sev.html#a0edf54321d64532405b9786dd707e026">More...</a><br /></td></tr>
<tr class="separator:a0edf54321d64532405b9786dd707e026"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a698747fabbaff0c6083b61e064e39e77"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classflow_1_1log_1_1Config_1_1Atomic__raw__sev.html#a698747fabbaff0c6083b61e064e39e77">Atomic_raw_sev</a> (const <a class="el" href="classflow_1_1log_1_1Config_1_1Atomic__raw__sev.html">Atomic_raw_sev</a> &amp;src)</td></tr>
<tr class="memdesc:a698747fabbaff0c6083b61e064e39e77"><td class="mdescLeft">&#160;</td><td class="mdescRight">Constructs the atomic to hold the value X held by the given other atomic accoding to a <code>memory_order_relaxed</code> load of the latter.  <a href="classflow_1_1log_1_1Config_1_1Atomic__raw__sev.html#a698747fabbaff0c6083b61e064e39e77">More...</a><br /></td></tr>
<tr class="separator:a698747fabbaff0c6083b61e064e39e77"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p >Trivial wrapper of <code>atomic&lt;raw_sev_t&gt;</code> which adds a couple of things to make it possible to construct, and therefore use, a <code>vector</code> of such <code>atomic</code>s. </p>
<p >The primary reason it exists is that it's not possible to <code>push_back()</code> (and therefore <code>resize()</code>) or surprisingly even <code>reserve()</code> (hence <code>emplace_back()</code> is also impossible) onto a <code>vector&lt;atomic&lt;&gt;&gt;</code>. A copy constructor is required. Without one, I (ygoldfel) was able to <em>almost</em> get it to build, except it turns out that even <code>reserve()</code> (which essentially is required for anything that grows the sequence) needs to be able to copy <code>atomic&lt;&gt;</code>s &ndash; albeit uninitialized ones &ndash; even if one plans to construct in-place via <code>emplace_back()</code> (etc.). We hence provide a copy constructor ourselves in the wrapper; but note that it has certain stringent requirements for safe use; see its doc header.</p>
<p >A side nicety is we can set the default constructor to, instead of keeping the value unspecified (probably uninitialized but definitely resulting in a valid object), init it to our special value <code>raw_sev_t(-1)</code>, which is used in <a class="el" href="classflow_1_1log_1_1Config.html#a3c5c7d62daba9625b0309b31da287585" title="Short-hand for fast-lookup, thread-safe-for-RW mapping from flat-union-component-table index to max a...">Config::Component_union_idx_to_sev_map</a> to represent the concept "index-not-in-map." That's mere syntactic sugar, but it works for us.</p>
<dl class="section see"><dt>See also</dt><dd>I (ygoldfel) discovered and solved this all myself when trying to compile; but it's a generally easily Googlable situation and solution (that confirmed my findings); e.g.: <a href="https://stackoverflow.com/questions/12003024/error-with-copy-constructor-assignment-operator-for-a-class-which-has-stdatomi">https://stackoverflow.com/questions/12003024/error-with-copy-constructor-assignment-operator-for-a-class-which-has-stdatomi</a> </dd></dl>

<p class="definition">Definition at line <a class="el" href="config_8hpp_source.html#l00882">882</a> of file <a class="el" href="config_8hpp_source.html">config.hpp</a>.</p>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a id="a0edf54321d64532405b9786dd707e026" name="a0edf54321d64532405b9786dd707e026"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0edf54321d64532405b9786dd707e026">&#9670;&nbsp;</a></span>Atomic_raw_sev() <span class="overload">[1/2]</span></h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">flow::log::Config::Atomic_raw_sev::Atomic_raw_sev </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classflow_1_1log_1_1Config.html#acae76e3367bd497f5b00f46e48b3a39c">raw_sev_t</a>&#160;</td>
          <td class="paramname"><em>init_val</em> = <code><a class="el" href="classflow_1_1log_1_1Config.html#acae76e3367bd497f5b00f46e48b3a39c">raw_sev_t</a>(-1)</code></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Constructs the atomic to the given value, guaranteed to be <code>load()</code>ed as such in all subsequent accesses incl from other threads, even if <code>memory_order_relaxed</code> is used. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">init_val</td><td>The value whose copy to set as the payload of this <code>atomic&lt;&gt;</code>. </td></tr>
  </table>
  </dd>
</dl>

<p class="definition">Definition at line <a class="el" href="config_8cpp_source.html#l00274">274</a> of file <a class="el" href="config_8cpp_source.html">config.cpp</a>.</p>

</div>
</div>
<a id="a698747fabbaff0c6083b61e064e39e77" name="a698747fabbaff0c6083b61e064e39e77"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a698747fabbaff0c6083b61e064e39e77">&#9670;&nbsp;</a></span>Atomic_raw_sev() <span class="overload">[2/2]</span></h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">flow::log::Config::Atomic_raw_sev::Atomic_raw_sev </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classflow_1_1log_1_1Config_1_1Atomic__raw__sev.html">Atomic_raw_sev</a> &amp;&#160;</td>
          <td class="paramname"><em>src</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Constructs the atomic to hold the value X held by the given other atomic accoding to a <code>memory_order_relaxed</code> load of the latter. </p>
<p >There is a subtlety: One generally expects that a just-constructed <code>atomic&lt;&gt; X(a)</code> must yield <code>X.load(memory_order_relaxed) == a</code> no mater the thread where the load is done or how soon after construction. Yet the present ctor by definition essentially performs <code>atomic&lt;&gt; X(src.load(memory_order_relaxed))</code>, hence the subtlety: The <code>src.load()</code> needs to return the "true" value intended to be stored inside <code>src</code>, not some cached/whatever older value in the current thread. One way to guarantee this is to both construct (and optionally modify) <code>src</code> <em>only</em> in the present thread before calling the present ctor.</p>
<p >Be very careful to ensure you've considered this when copy-contructing. Otherwise, it will probably work the <em>vast</em> majority of the time; yet it may silently result in <code>this-&gt;load(memory_order_relaxed)</code> returning some unexpected value, depending on whether the "master" value of <code>src</code> has propagated to the present thread. Formally speaking behavior is undefined outside of the aforementioned condition. In actual fact, we do guarantee this when growing <a class="el" href="classflow_1_1log_1_1Config.html#a6b6b4511883c815e81f6427909ed829f" title="Maps from flat union component index to most verbose (highest) log::Sev for which output_whether_shou...">Config::m_verbosities_by_component</a>; and the other call site is the <code>default</code> <a class="el" href="classflow_1_1log_1_1Config.html" title="Class used to configure the filtering and logging behavior of Loggers; its use in your custom Loggers...">Config</a> copy constructor/etc., whose doc header mentions this limitation.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">src</td><td>Other object. Behavior undefined if <code>(this == &amp;src)</code>. </td></tr>
  </table>
  </dd>
</dl>

<p class="definition">Definition at line <a class="el" href="config_8cpp_source.html#l00280">280</a> of file <a class="el" href="config_8cpp_source.html">config.cpp</a>.</p>

</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>log/<a class="el" href="config_8hpp_source.html">config.hpp</a></li>
<li>log/<a class="el" href="config_8cpp_source.html">config.cpp</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Fri Mar 28 2025 22:55:35 for Flow by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.4
</small></address>
</body>
</html>
